package cc.czlee.cloud.demo.controller;

import cc.czlee.cloud.demo.service.UserFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/*
 * Create by Colbert on 2019-05-01
 *
 * Copyright (C) 2019 chuanzhigo@gmail.com.
 */
@RestController
public class LoginController {

    @Resource
    UserFeignClient userFeignClient;

    Logger logger = LoggerFactory.getLogger(LoginController.class);

    @GetMapping("/login")
    public String login(String username, String password) {
        //User user = new User();
        //user.setUsername(username);
        //user.setPassword(password);
        //if (userFeignClient.login(user)) {
        //    return "登录成功";
        //}
        //return "登录失败";
        for (int i = 0; i < 10; i++) {
            String result = userFeignClient.login(i);
            logger.warn("login " + result);
        }
        return "登录负载均衡测试完成";
    }
}
